 <template>
  <div slot="book">
    <a-card
      :title="book.title"
      :isbn="book.isbn"
      :marcid="book.bookid"
      :headStyle="headStyles"
      style="width: 100%"
    >
      <a-row :gutter="16" type="flex" justify="space-around" align="middle">
        <a-col :xs="23" :sm="23" :md="8" :lg="4" :xl="4">
          <img
            align="center"
            :src="book.cover"
            width="100%"
            style="margin: 0 auto; display: block"
          />
        </a-col>
        <a-col :xs="1" :sm="1" :md="1" :lg="1" :xl="1"> </a-col>

        <a-col :xs="24" :sm="24" :md="13" :lg="15" :xl="19">
          <a-row>
            <blockquote>
              <p class="list-group-item-text text-muted" name="author">
                作者:{{ book.author }}&nbsp;&nbsp;/&nbsp;&nbsp;出版日期:{{
                  book.publish_date
                }}&nbsp;&nbsp;/&nbsp;&nbsp;提供商:{{ book.src }}
              </p>
              <p
                class="list-group-item-text text-muted"
                name="isbn"
                :value="book.isbn"
              >
                ISBN:{{ book.bisbn }}&nbsp;&nbsp;/&nbsp;&nbsp;分类:{{
                  book.cates
                }}&nbsp;&nbsp;/&nbsp;&nbsp;格式:{{ book.filetype }}
              </p>
            </blockquote>
          </a-row>
          <a-row>
            <a-divider dashed />
          </a-row>
          <a-row>
            <a-button-group style="display: flex">
              <a-button
                type="danger"
                @click="EmitGetBookInfo(book.bookid, book.title,book.isbn)"
              >
                纸书
              </a-button>
              <a-button
                style="margin: 0 5px"
                type="danger"
                v-if="book.ebooklist != ''"
              >
                <a :href="book.ebooklist.link" target="_blank">本馆电子书</a>
              </a-button>
            </a-button-group>
          </a-row>
        </a-col>
      </a-row>
    </a-card>
  </div>
</template>

<script>
// import axios from "axios";
// import VueAxios from "vue-axios";
export default {
  props: {
    book: Object,
    id: Number,
    title: String,
    author: String,
    publisher: String,
    publish_date: String,
    pub_year: Number,
    cover: String,
    intro: String,
    isbn: String,
    bisbn: String,
    category: String,
    cates: String,
    booktype: String,
    filetype: String,
    bookid: String,
    assertId: String,
    src: String,
    view_count: Number,
    extid: String,
    ext: String,
    created_at: Number,
    updated_at: Number,
    pc_read: String,
    pc_epub: String,
    wx_read: String,
    wx_epub: String,
    read: String,
    detail: String,
    content: String,
    ebooklist: Array,
  },
  data: () => ({
    is_bookinfo_visible: false,
    is_spinning: false,
    header: {},
    body: {},
    info: [],
    headStyles: {
      color: "#2780e3",
      background: "#f5f5f5",
    },
    customStyle: "color:#2780e3",
  }),
  watch: {},
  computed: {
    getclassname() {
      return this.$store.state.Namedparent.name;
    },
  },
  methods: {
    godetail(id, title) {
      this.$store.commit(
        this.$store.state.Namedparent.name + "/SHOW_DETAIL",
        true
      );
      var paras = {
        id: id,
        searchtitle: title,
        type: this.$store.state.Namedparent.name,
      };
      this.$store.commit(
        this.$store.state.Namedparent.name + "/ChangeDetailQuery",
        paras
      );
      this.$router.push({
        path: "/detail",
        query: {
          searchtitle: title,
          id: id,
          type: this.$store.state.Namedparent.name,
        },
        // params: { id: JSON.stringify(this.$store.rs) },
      });
    },
    showDrawer() {
      this.is_bookinfo_visible = true;
      this.$emit("showbookid", true, this.bookid, this.title);
      this.$store.commit("Paperbook/BOOKINFO_ALREADY_SHOW", true);
    },
    onDrawerClose() {
      this.is_bookinfo_visible = false;
      this.$emit("showbookid", false);
      this.$store.commit("Paperbook/BOOKINFO_ALREADY_SHOW", false);
    },
    EmitGetBookInfo(marc_no, title,isbn) {
      // this.$emit("showbookid", false, marc_no, title);
      // this.$store.commit("Paperbook/BOOKINFO_ALREADY_SHOW", false);

       var paras = {
            id:marc_no,
            searchtitle:title,
            type:this.$store.state.Namedparent.name
      }
       this.$store.commit(this.$store.state.Namedparent.name+'/ChangeDetailQuery',paras)
        this.$router.push({
          path: '/PBookDetail', //QikanrBookDetail
          query: { 
            searchtitle:title,
            id:marc_no,
            isbn:isbn,
         },
      });
    },
  },
  mounted() {
    this.$store.commit(
      this.$store.state.Namedparent.name + "/SHOW_DETAIL",
      false
    );
  },
};
</script>

<style scoped>
/deep/.ant-collapse-header {
  color: blueviolet !important;
}
/* .text-muted{
    font-size: 15px;
  } */
.text-muted p {
  border-bottom: 1px dashed #efefef;
  line-height: 2;
}
.text-muteds {
  text-align: center;
  margin: 5px auto;
}
.text-muteds p {
  margin: 0;
  height: 20px;
  line-height: 20px;
  overflow: hidden;
}
.btn-success {
  color: #ffffff;
  background-color: #3fb618;
  border-color: #3fb618;
  text-align: center;
  border: 1px solid transparent;
  padding: 10px 10px;
  font-size: 15px;
}
.btn-successread {
  display: inline;
  color: #ffffff;
  background-color: #3fb618;
  border-color: #3fb618;
  text-align: center;
  border: 1px solid transparent;
  padding: 10px 10px;
  font-size: 15px;
}
.btn-successread:hover {
  background: #25690f;
}
.bookurl {
  width: 100%;
  display: block;
  height: 50px;
  position: absolute;
  top: 0;
  left: 0;
}
blockquote {
  padding: 10.5px 21px;
  margin: 0 0 21px;
  font-size: 15.75px;
  border-left: 5px solid #e6e6e6;
}
.list-group-item-text {
  margin-bottom: 0;
  line-height: 1.6;
}
.text-muted {
  color: #999999;
}
</style>
